package cn.bocai.pc.ws.service.impl;

import java.io.File;
import java.util.ArrayList;

import cn.bocai.pc.ws.service.FileVerificationService;

public class FileVerificationServiceImpl implements FileVerificationService{

	@Override
	public String fileCheck(String url) {
		File file=new File(url);
		if(file.exists()){//如果存在就删除
			file.delete();
		} 
		return "ok";
	}

	@Override
	public ArrayList<String> queryFolder(String url) {
		//D:/ruanjian/eclipse/file/newBcai/pc-image/src/main/webapp/2015/black/4
		 File file = new File(url);
	        File [] files = file.listFiles();
	        ArrayList<String> list = new ArrayList<String>();  
	        for (int i = 0; i < files.length; i++){
	            File file1 = files[i];
	            String name = file1.getName();   //根据后缀判断
	            list.add(name);
	            System.out.println(name);
	        }
		return list;
	}

}
